

function addUser(a:string,b:string):void {
  
  console.log(`${a}-${b}`);
  
}

addUser('zhichao','666')

type f1 = (aaaaa: string, bbbbb: string) => void

let addUser2:f1 = function (a:string,b:string):void {

  console.log(`${a}-${b}`);

}

let bl:string = 'sdfsdf'

addUser2('zhichao','888')


let sumNum:(baseVal:number,inc:number)=>number = function (val,inc) {
  return val+inc
}

let arra= [32,42,4,24,23,4,234]

arra.concat(32,42,4,24,23,4,234)  // 
let numArrs = arra.concat(...arra,32,42,4,24,23,4,234,...arra) // ...arra = 32,42,4,24,23,4,234

console.log(numArrs);


// arra.forEach(element => {
  
// });

// (value: number, index: number, array: number[]) => void


// forEach(callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any): void



// 可选值
// 1.可选值要标识上 undefined 类型
// 2.在程序中处理 undefined 结果
function addUser3(a:string,b?:string | undefined):void {
  
  console.log(`${a}-${b || '8666'}`);

  if (b) {
    
  }
  
}
addUser3('志超')


type sumNumType =  (baseVal:number,inc?:number | undefined)=>number
let sumNum4:sumNumType = function (val,inc) {

  let i = inc || 0
  return val+(inc || 0)
}


console.log('---------------------------------------')

// 函数参数的默认值 //通过默认值的方式 解决 undefined 不匹配问题
const fn:(name?: string) => string = (name: string = "我是默认值"): string => {
  return name
}

console.log(fn());



interface InterArray {
  [index:number]:undefined | string  | number
}
// 定义剩余参数

const fn2323 = (a:number,...items:(string|number)[]):InterArray => {
 
  return items
}


fn2323(2323,'234','23424','23424',234234)




// 返回对象
interface IfnRes {
  name:string
  age:number
} 

const fn9999:(name: string,age:number) => IfnRes = (name,age) => {
  return {
    age:23432,
    name:'chao'
  }
}

let liEl:NodeListOf<HTMLLIElement> = document.querySelectorAll('li') 
